import http from '@/utils/http/axios';

/**
 * 加载字典数据
 */
export function loadDictData() {
  return http.request({
    url: '/sys/dict',
    method: 'get',
  });
}

/**
 * 新增字典
 * @param data
 */
export function saveDict(data) {
  return http.request({
    url: '/sys/dict',
    method: 'post',
    data,
  });
}

/**
 * 编辑字典
 * @param data
 */
export function editDict(data) {
  return http.request({
    url: '/sys/dict',
    method: 'put',
    data,
  });
}
export function removeDict(params) {
  return http.request({
    url: '/sys/dict',
    method: 'delete',
    params,
  });
}
/**
 * 查询字典项目
 * @param params
 */
export function findDictItemList(params) {
  return http.request({
    url: '/sys/dict/item',
    method: 'get',
    params,
  });
}

/**
 * 删除字典值
 * @param params
 */
export function deleteDictItem(params) {
  return http.request({
    url: '/sys/dict/item',
    method: 'delete',
    params,
  });
}

/**
 * 添加字典值
 * @param data
 */
export function addDictItem(data) {
  return http.request({
    url: '/sys/dict/item',
    method: 'post',
    data,
  });
}

/**
 * 修改字典值
 * @param data
 */
export function editDictItem(data) {
  return http.request({
    url: '/sys/dict/item',
    method: 'put',
    data,
  });
}
/**
 * 校验字典编码唯一性
 * @param dictCode
 */
export function checkDictCode(params) {
  return http.request({
    url: '/sys/dict/checkDictCode',
    method: 'get',
    params,
  });
}
export function findDictList() {
  return http.request({
    url: `/sys/dict/findDictList`,
    method: 'get',
  });
}
